/****************************************************************************************************
 ** @file       algorithms.c
 ** @brief      
 ** @details
 **   
 ** @copyright  S7501
 ** @author     yss93
 ** @date       2021/10/14
 **************************************************************************************************/

#include "algorithms.h"


PUBLIC INT32 CmpDouble(const void *vp1,const void *vp2){
    return *(double *)vp1 - *(double *)vp2;
}

PUBLIC INT32 CmpFloat(const void *vp1,const void *vp2){
    return *(float *)vp1 - *(float *)vp2;
}

PUBLIC void QuickSort(void *arr, size_t len,size_t elemSize, CmpFunc cmp){
    qsort(arr,len,elemSize,cmp);
}

PUBLIC void QuickSortDouble(double *arr, size_t len){
    QuickSort(arr,len,sizeof(double),CmpDouble);
}


PUBLIC void QuickSortFloat(float *arr, size_t len){
    QuickSort(arr,len,sizeof(float),CmpFloat);
}
